#测试夹层文件，用于共享fixture
import pytest
from utils.browser import get_browser
from pages.login_page import TestLogin
from config.config import BROWSER_TYPE, BASE_URL

@pytest.fixture(scope="function")
def driver():
    """
    浏览器驱动 fixture，每个测试函数都会重新初始化
    """
    driver = get_browser(BROWSER_TYPE)
    driver.get(BASE_URL)
    yield driver
    driver.quit()

@pytest.fixture(scope="function")
def login_page(driver):
    """
    登录页面对象 fixture
    """
    login_page = TestLogin(driver)
    yield login_page
    login_page.teardown()  # 调用页面对象的清理方法